local skel = fk.CreateSkill{
  name = "fm__lianying",
}
local TeaU = require "packages.wild_collection.utility.utility"
Fk:loadTranslationTable{
  ["fm__lianying"] = "连营",
  [":fm__lianying"] = "出牌阶段限一次，你可以交给一名其他角色一张牌，然后销毁其所有牌中与此牌花色相同的牌，"..
  "若你以此法一次销毁了至少三张牌，你对其造成1点火焰伤害。",

  ["$fm__lianying1"] = "今出其不意，自可擒制。",
  ["$fm__lianying2"] = "吾已晓破之之术。",
}
---@type ActiveSkillSpec
local lianying = {
  anim_type = "offensive",
  card_num = 1,
  target_num = 1,
  can_use = function (self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0 and not player:isNude()
  end,
  card_filter = function (self, player, to_select, selected)
    return #selected == 0
  end,
  target_filter = function (self, player, to_select, selected, selected_cards)
    return #selected == 0 and to_select ~= player
  end,
  on_use = function (self, room, effect)
    local player = effect.from
    local to = effect.tos[1]
    room:obtainCard(to, effect.cards, false, fk.ReasonGive, player, skel.name)
    if not to.dead then
      local card = Fk:getCardById(effect.cards[1])
      local suit = card.suit
      local cids = table.filter(to:getCardIds("he"), function(id)
        local c = Fk:getCardById(id)
        return c.suit == suit
      end)
      if #cids > 0 then
        TeaU.burnCards(room, cids, player, skel.name)
        if not player.dead and not to.dead and #cids > 2 then
          room:damage{
            from = player,
            to = to,
            damage = 1,
            damageType = fk.FireDamage
          }
        end
      end
    end
  end
}
skel:addEffect("active", lianying)
return skel